﻿namespace SupportSystemDB
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Events Controller Class.
    /// </summary>
    public class EventController : ParentController
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="EventController"/> class.
        /// </summary>
        /// <param name="dataAccess">The data access.</param>
        internal EventController(SupportEntities dataAccess) : base(dataAccess)
        {
        }

        /// <summary>
        /// Gets the specified event.
        /// </summary>
        /// <param name="eventId">The event id.</param>
        /// <returns>current event</returns>
        public Event Get(int eventId)
        {
            return this.SupportDB.GetEventById( eventId ).FirstOrDefault();
        }

        /// <summary>
        /// Gets the events in year.
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns>List of events in current year</returns>
        public List<Event> GetInYear( int year )
        {
            return this.SupportDB.GetEventsByYear( year ).ToList();
        }
    }
}
